package com.kfm.pm.movie;

public class MyRunnable implements Runnable{

    private volatile int count = 0;
    @Override
    public void run() {
        synchronized (this) { // 实例方法是 this   静态方法 是 类名.class
            count ++;
            System.out.println(count);
        }

    }
}

class Demo {

    public static void main(String[] args) {
        Runnable run = new MyRunnable();
        for (int i = 0; i < 100000; i ++) {
            Thread thread = new Thread(run);
            thread.start();
        }
    }
}
